<title>充值到余额 - 期金管家</title>
{include file="Public/header"/}
<!--正文-->
<div class="container">
    <form action="/home/Apaycard/pageadds" method="post" class="form-horizontal">

        <div class="row">
            <div class="col-md-12 mt20">
                <p class="h3">快捷绑定</p>
            </div>

            <div class="col-md-12 mt20">
                <label class="col-md-2 col-md-offset-2 control-label">充值方式：</label>
                <div class="col-md-4" style="padding-top: 7px;">快捷银联支付</div>
            </div>

            <div class="col-md-12 mt20">
                <label class="col-md-2 col-md-offset-2 control-label">姓名：</label>
                <div class="col-md-4">
                    <div class="input-group">
                        <span class="input-group-addon"><span class="glyphicon glyphicon-user"></span></span>
                        <input type="text" class="form-control" name='name' value='{$data.name}' readonly="readonly">
                    </div>
                </div>
            </div>

            <div class="col-md-12 mt20">
                <label class="col-md-2 col-md-offset-2 control-label">身份证：</label>
                <div class="col-md-4">
                    <div class="input-group">
                        <span class="input-group-addon"><span class="glyphicon glyphicon-align-justify"></span></span>
                        <input type="text" class="form-control" name='cer' value="{$data.IDnumber}" readonly="readonly">
                    </div>
                </div>
            </div>

            <div class="col-md-12 mt20">
                <label class="col-md-2 col-md-offset-2 control-label">储蓄卡卡号：</label>
                <div class="col-md-4">
                    <div class="input-group">
                        <span class="input-group-addon"><span class="glyphicon glyphicon-credit-card"></span></span>
                        <input type="text" class="form-control" name='card' placeholder="请输入储蓄卡卡号" required="required">
                    </div>
                </div>
            </div>

            <div class="col-md-12 mt20">
                <label class="col-md-2 col-md-offset-2 control-label">手机号码：</label>
                <div class="col-md-4">
                    <div class="input-group">
                        <span class="input-group-addon"><span class="glyphicon glyphicon-phone"></span></span>
                        <input type="text" class="form-control" name='phone' placeholder="请输入手机号码" required="required">
                    </div>
                </div>
            </div>


            <div class="col-md-12 mt20">
                <label class="col-md-2 col-md-offset-2 control-label">验证码：</label>
                <div class="col-md-4">
                    <div class="input-group">
                        <span class="input-group-addon"><span class="glyphicon glyphicon-qrcode"></span></span>
                        <input type="text" class="form-control" name="code" id="uSmsCode" placeholder="手机验证码" value=""
                               required="required">
                        <div class="input-group-btn">

                            <input type="button" class="btn btn-default btn-success" id="btnSmsCode" value="获取验证码"/>
                            <!--<input type="submit" class="btn btn-default btn-success" id="btnSmsCode" value="获取验证码">-->
                        </div>
                    </div>
                </div>
            </div>

            <div class="col-md-12 mt20">
                <div class="col-md-2 col-md-offset-2 text-right"></div>
                <div class="col-md-4"><button  class="btn btn-primary">确定签约</button></div>
            </div>


        </div>
    </form>
</div>
<!--<script src="/static/home/js/jquery.min.js"></script>-->
<script type="text/javascript" src="/static/home/js/jquery-3.3.1.min.js"></script>
<div class="clearfix blank30"></div>
<!--版权信息-->
{include file="Public/footer"/}

<script>

    //  $("#btnSmsCode").click(function () {
    //      //调用获取验证码60S函数
    //      settime(this);
    //  });

    //获取验证码60S函数
    var countdown = 60;
    function settime(obj) {
        if (countdown == 0) {
            obj.removeAttribute("disabled");
            obj.value = "获取验证码";
            countdown = 60;
            return;
        } else {
            obj.setAttribute("disabled", true);
            obj.value = "重新发送(" + countdown + ")";
            countdown--;
        }
        setTimeout(function () {
                    settime(obj)
                }
                , 1000)
    }

    //获取手机短信码
    $("#btnSmsCode").click(function invokeSettime(obj) {
                obj=this;
                /*$.post('__ROOT__/home/Userrecharge/pageadds', {name:name,cer:cer,card:card,phone:phone,code:code}, function (data) {
                 // alert(data);
                 var objs = JSON.parse(data);
                 if (objs.msg != 'success') {
                 $("#mobile").html(objs.msg).show().css("color", "red");
                 $("#btnSmsCode").attr("disabled", "disabled");
                 // flag = false;
                 } else {
                 // flag = true;
                 }
                 });*/
                // 线下
                var formData = new FormData();
                formData.append("name", $("input[name='name']").val());
                formData.append("cer", $("input[name='cer']").val());
                formData.append("card", $("input[name='card']").val());
                formData.append("phone", $("input[name='phone']").val());
                formData.append("code",0);
                console.log($)
                $=jQuery;
              $.ajax({
                    url: 'http://www.lc2.com/home/Apaycard/pageadds',
                    type: 'POST',
                    data: formData,
                    processData: false,
                    contentType: false,
                    success: function (data) {
                        if(data.respDesc!='成功'){
                            alert(data.respDesc);
                        }else{
                            settime(obj);
                        }
                        // console.log(data);
                        // alert(data)
                    }
                });

            }
    )



</script>